package com.ruoyi.business.service.impl;

import java.util.Collections;
import java.util.List;
import java.util.Map;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.HurtDoctorArticleMapper;
import com.ruoyi.business.domain.HurtDoctorArticle;
import com.ruoyi.business.service.IHurtDoctorArticleService;

/**
 * 医师文章Service业务层处理
 *
 * @author ruoyi
 * @date 2024-04-17
 */
@Service
public class HurtDoctorArticleServiceImpl implements IHurtDoctorArticleService
{
    @Autowired
    private HurtDoctorArticleMapper hurtDoctorArticleMapper;

    /**
     * 查询医师文章
     *
     * @param id 医师文章主键
     * @return 医师文章
     */
    @Override
    public HurtDoctorArticle selectHurtDoctorArticleById(Long id)
    {
        return hurtDoctorArticleMapper.selectHurtDoctorArticleById(id);
    }

    /**
     * 查询医师文章列表
     *
     * @param hurtDoctorArticle 医师文章
     * @return 医师文章
     */
    @Override
    public List<HurtDoctorArticle> selectHurtDoctorArticleList(HurtDoctorArticle hurtDoctorArticle)
    {
        return hurtDoctorArticleMapper.selectHurtDoctorArticleList(hurtDoctorArticle);
    }

    /**
     * 新增医师文章
     *
     * @param hurtDoctorArticle 医师文章
     * @return 结果
     */
    @Override
    public int insertHurtDoctorArticle(HurtDoctorArticle hurtDoctorArticle)
    {
        hurtDoctorArticle.setCreateTime(DateUtils.getNowDate());
        return hurtDoctorArticleMapper.insertHurtDoctorArticle(hurtDoctorArticle);
    }

    /**
     * 修改医师文章
     *
     * @param hurtDoctorArticle 医师文章
     * @return 结果
     */
    @Override
    public int updateHurtDoctorArticle(HurtDoctorArticle hurtDoctorArticle)
    {
        return hurtDoctorArticleMapper.updateHurtDoctorArticle(hurtDoctorArticle);
    }

    /**
     * 批量删除医师文章
     *
     * @param ids 需要删除的医师文章主键
     * @return 结果
     */
    @Override
    public int deleteHurtDoctorArticleByIds(Long[] ids)
    {
        return hurtDoctorArticleMapper.deleteHurtDoctorArticleByIds(ids);
    }

    /**
     * 删除医师文章信息
     *
     * @param id 医师文章主键
     * @return 结果
     */
    @Override
    public int deleteHurtDoctorArticleById(Long id)
    {
        return hurtDoctorArticleMapper.deleteHurtDoctorArticleById(id);
    }

    @Override
    public List<Map<String, Object>> getDoctorArticleList(String title) {
        return hurtDoctorArticleMapper.getDoctorArticleList(title);
    }

    @Override
    public void updateClickNum(Long id) {
        hurtDoctorArticleMapper.updateClickNum(id);
    }

    @Override
    public Map<String, Object> readArticleById(Long id) {
        return hurtDoctorArticleMapper.readArticleById(id);
    }

    @Override
    public List<Map<String, Object>> getDoctorArticleListByDoctorId(Long doctorId) {
        return hurtDoctorArticleMapper.getDoctorArticleListByDoctorId(doctorId);
    }

    @Override
    public List<Map<String, Object>> getDoctorOwnArticleList(Long doctorId) {
        return hurtDoctorArticleMapper.getDoctorOwnArticleList(doctorId);
    }

    @Override
    public Map<String, Object> getArticleDetail(Long id) {
        return hurtDoctorArticleMapper.getArticleDetail(id);
    }
}
